package week3;
import java.util.Scanner;
public class GuessNumberGame {
    public static void main(String[]args){
        int randomNumber=(int)(Math.random()*100+1);
        Scanner scanner =new Scanner(System.in);
        int guessCount=0;
        int guessNumber;
        do {
            System.out.print("请输入你猜的数字（1-100）：");
            guessNumber=scanner.nextInt();
            guessCount++;
            if (guessNumber>randomNumber){
                System.out.println("大了");
            } else if (guessNumber<randomNumber) {
                System.out.println("小了");
            }else {
                System.out.println("对了，一共猜了"+guessCount+"次");
            }
        }while (guessNumber!=randomNumber);
        scanner.close();
    }
}
